﻿@model Nop.Web.Models.ShareBuy.ShareBuyModel
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";
    //title
    Html.AddTitleParts(Model.Title);
    //description
    Html.AddMetaDescriptionParts(Model.Description);
}
@Html.HiddenFor(model => model.Id)
<link href="~/Themes/Jewelry/Content/css/share.css" rel="stylesheet" />
<link href="/Scripts/ad-gallery/ad-gallery.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/ad-gallery/jquery.ad-gallery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.ad-gallery').adGallery({
            slideshow:{enable: false,controls:false}
        });

        $("#btnVote").click(function () {
            $.ajax({
                cache:false,
                type: "POST",
                url: "@Url.Action("AddVote", "ShareBuy")",
                data: { "shareBuyItemId": @Model.Id },
                success: function (data) {
                    if(data.Result==true)
                    {
                        alert("successfully");
                    }
                    else if(data.Result=="Exists"){
                        alert("you had voted");
                    }
                    else
                    {
                        alert('Failed to add Sharing.');
                    }
                    $(this).attr('disabled', false);
                },
                error:function (xhr, ajaxOptions, thrownError){
                    alert('Failed to add Sharing.')
                    $(this).attr('disabled', false);
                }  
            });
        });
    });
</script>

@section left
{
    <!--pinfo start-->
    <div id="productInfo" class="block">
        <div class="title">
            <strong>Share Product</strong>
        </div>
        <div>
            <div class="p-img">
                <a target="_blank" href="@Url.RouteUrl("Product", new { productId = Model.ProductId, SeName = Model.ProductSeName })">
                    <img src="@Model.ProductDetailsModel.DefaultPictureModel.ImageUrl"
                                alt="">
                </a>
            </div>
            <div class="p-name">
                Name：<a target="_blank" href="@Url.RouteUrl("Product", new { productId = Model.ProductId, SeName = Model.ProductSeName })">@Model.ProductName</a>
            </div>
            <div class="p-price">
                Price：@Model.ProductDetailsModel.ProductPrice.Price
            </div>
            <div class="num-comment">
                Comments：<span>@Model.ShareBuyCommentModels.Count</span>
            </div>
            @*<div class="btn">
                        <a href="#" class="btn-append">Add to cart</a>
                    </div>*@
        </div>
    </div>
    <div class="clear">
    </div>
    @Html.Action("ShareCategoryNavigation", "ShareBuy", new { currentCategoryId = 159/*159,177*/ })
}
<div id="shareroot">
    <div class="title">
        <h2>
            @Model.Title</h2>
        <div class="partake">
            <span class="txt">Share to：</span>@Html.Action("ShareButton", "Catalog")
        </div>
    </div>
    <div id="photos" class="mc">
        <table id="layout">
            <tbody valign="top">
                <tr>
                    <td class="user">
                        <div class="u-icon">
                            <img width="60" height="60" src="@Model.CustomerAvatarUrl">
                        </div>
                        <div class="u-name">
                            @Model.CustomerName
                        </div>
                        <div class="u-address">
                        </div>
                    </td>
                    <td>
                        <div class="description">
                                @Model.Description
                            </div>
                            <div id="preview">
                                <div id="gallery" class="ad-gallery">
                                    <div class="ad-image-wrapper">
                                    </div>
                                    <div class="ad-controls">
                                    </div>
                                    <div class="ad-nav">
                                        <div class="ad-thumbs">
                                            <ul class="ad-thumb-list">
                                                @foreach (var picture in Model.ShareBuyPictureModels)
                                                {
                                                    <li><a href="@picture.PictureUrl">
                                                        <img src="@picture.PictureUrl90"/>
                                                    </a></li>
                                                }
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="item-info">
                                <div class="fl">
                                    <a href="#reply">Reply</a>
                                </div>
                                <div class="fr">
                                    Shared on @Model.CreatedOnUtc
                                </div>
                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <!-- Comments -->
        @if (Model.ShareBuyCommentModels.Count > 0)
        {
            int i = 1;
            foreach (var comment in Model.ShareBuyCommentModels)
            {
            <table id="replayList" cellspacing="0" cellpadding="0" border="0">
                <tbody valign="top">
                    <tr>
                        <td class="user">
                            <div class="u-icon">
                                <img width="60" height="60" src="@comment.CustomerAvatarUrl">
                            </div>
                            <div class="u-name">
                                @comment.CustomerName

                            </div>
                            <div class="u-address">
                            </div>
                        </td>
                        <td valign="top" class="cont">
                            <div class="item">
                                <div class="i-item">
                                    @comment.CommentText
                                </div>
                                <div class="item-info">
                                    <div class="fl">
                                        <a href="#reply">Reply</a>
                                    </div>
                                    <div class="fr">
                                        Reply on @comment.CreatedOn
                                    </div>
                                </div>
                                <div class="floor">
                                    @i floor
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
                i++;
            }

        }
    </div>
    @using (Html.BeginForm())
    {
        <div id="reply" class="m">
            <div class="mt">
                <h2>Reply</h2>
            </div>
            <div class="mc">
                <div class="item">
                    <div class="tit">
                        Content：
                    </div>
                    <div class="cont">
                         @Html.TextAreaFor(x => x.AddShareBuyCommentModel.CommentText, new { style = "width:500px; Height: 50px;",@class="comment" })
                    </div>
                </div>
                <div class="item">
                    <input type="submit" name="save" value="Submit" class="button-10" onclick="if($.trim($('.comment').val())=='') return false;"/>
                </div>
            </div>
        </div>
    }
</div>

